package dao

import (
	"time"
)

// 这是 CmsSubject 的全局公开dao对象，被service层调用!
var CmsSubjectDao = cmsSubjectDao{}

// 这是 cms_subject表 的实体类
type CmsSubject struct {
	AlbumPics       string    `json:"album_pics" form:"album_pics" v:"album_pics"`          // 画册图片用逗号分割
	CategoryId      int64     `json:"category_id" form:"category_id" v:"category_id"`       // 这是一个逻辑外键,关联cms_subject_category(id)
	CategoryName    string    `json:"category_name" form:"category_name" v:"category_name"` // 专题分类名称
	CollectCount    int32     `json:"collect_count" form:"collect_count" v:"collect_count"`
	CommentCount    int32     `json:"comment_count" form:"comment_count" v:"comment_count"`
	Content         string    `json:"content" form:"content" v:"content"`
	CreateTime      time.Time `json:"create_time" form:"create_time" v:"create_time"`
	Description     string    `json:"description" form:"description" v:"description"`
	ForwardCount    int32     `json:"forward_count" form:"forward_count" v:"forward_count"` // 转发数
	Id              int64     `json:"id" form:"id" v:"id"`
	Pic             string    `json:"pic" form:"pic" v:"pic"`                               // 专题主图
	ProductCount    int32     `json:"product_count" form:"product_count" v:"product_count"` // 关联产品数量
	ReadCount       int32     `json:"read_count" form:"read_count" v:"read_count"`
	RecommendStatus int32     `json:"recommend_status" form:"recommend_status" v:"recommend_status"`
	ShowStatus      int32     `json:"show_status" form:"show_status" v:"show_status"` // 显示状态：0-&gt;不显示；1-&gt;显示
	Title           string    `json:"title" form:"title" v:"title"`
}

// 注意:这是 CmsSubject 的私有dao对象，只能在dao层内使用!
type cmsSubjectDao struct {
	InsertTemplate func(arg CmsSubject) (int64, error)                               //插入一条记录
	UpdateTemplate func(arg CmsSubject) (int64, error)                               //更新一条记录
	DeleteTemplate func(id int64) (int64, error)                                     `args:"id"`                         //根据传入的主键删除一条记录
	SelectTemplate func(id int64) (CmsSubject, error)                                `args:"id"`                         //根据传入的主键获取一条记录
	List           func(keyword string, pageNum, pageSize int) ([]CmsSubject, error) `args:"keyword,page_num,page_size"` //模糊分页查询
}

/*
// 这是 cms_subject 表的Postman测试参数
// 该结构体中的字段就是: 前后端交互的json字段!
type CmsSubjectPostman struct {
album_pics
category_id
category_name
collect_count
comment_count
content
create_time
description
forward_count
id
pic
product_count
read_count
recommend_status
show_status
title

}*/

// 这是 cms_subject 表的批量请求参数
type CmsSubjectReq struct {
	List []CmsSubject `json:"list" form:"list"`
}
